dojo.require("custom.exception.exception.Exception");
dojo.require("custom.exception.handler.ExceptionHandler");

htic.exceptionManager = ExceptionManager = {
	defaultHandler: 	new ExeptionHandler(),
	exceptionMap : {},
	
	fireException : function (ext){
		try {
			this.getHandler(ext).run(ext);
		} catch (e) {
			console.log(e);
		}
	},
	
	registerException : function (errType, errHandler) {
		this.exceptionMap[errType] = errHandler;			
	},
	
	getHandler : function(ext) {
		if (typeof(this.exceptionMap[ext.type]) != "undefined") {
			return this.exceptionMap[ext.type];
		}
		return 	this.defaultHandler;
		
	}
}
